<?php
include("../lib.php");

// connect to mysql

    $sqlservr_con = mysql_connect('127.0.0.1', 'root', 'gbifims');
    if (!$sqlservr_con) {
        die('db server unavailable.');    // . mysql_error());
    }
    $sql_con = mysql_select_db('gbif_ims', $sqlservr_con);
    if (!$sql_con) {
        die ('db unavailable.');    // . mysql_error());
    }

// insert if request
if( $_GET["email_address"] AND $_GET["user_name"])
{
    $user_name = strip_tags($_GET["user_name"]);
	$email_address = strip_tags($_GET["email_address"]);

	file_put_contents  ( "param_insert.txt", $user_name."/".$email_address);
	//add the user
	$db_query = sprintf("INSERT INTO users (user_name, email_address) VALUES ('".$user_name."','".$email_address."')");
		
	file_put_contents  ( "insert_statement.txt", $db_query);
	
	 // $db_query = sprintf("update email_address = '".$email_address."' where user_name='".$user_name."'");
	$result = mysql_query( $db_query );
	
	
}
    
mysql_free_result( $result )

?>